home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / extras / Direct3D / Tools / Maya30 / myassert.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-08  |  663 b   |  33 lines

  1. #ifndef MyAssert_h
  2. #define MyAssert_h
  3.  
  4.  
  5. #include <assert.h>
  6.  
  7.  
  8. #define INIT                                try    {                                                            
  9.  
  10. #define EXIT                                }                                                                \
  11.                                             catch (char* szError) {                                            \
  12.                                                 cerr << "ERROR [" << szError << "]" << endl;                \
  13.                                                                                                             \
  14.                                                 hr    = E_FAIL;                                                \
  15.                                             }
  16.  
  17.  
  18. #define ASSERT(condition, error_msg)        if (!(condition)) {                                                \
  19.                                                 throw error_msg;                                            \
  20.                                             }
  21.  
  22. #define HR_ATTEMPT(hresult, error_msg)        ASSERT(SUCCEEDED(hresult), (error_msg))
  23.  
  24.  
  25. // assert one type of Dt function
  26. #define    DT_ATTEMPT(statement)                statement
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33. #endif